package net.simflow.swf.analyzer.fileprinter;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class FilePrinter {
	public static final String NEW_LINE = "\r\n\r\n";
	public static final String TAB = "\r\n\t";

	private PrintWriter p;
	private FileWriter w;

	public void init(File file) throws IOException {
		if (!file.exists()) {
			file.createNewFile();
		}
		w = new FileWriter(file, true);
		p = new PrintWriter(w);
	}

	public void print(String text) {
		if (p == null) {
			return;
		}
		p.print(text);
	}

	public void close() throws IOException {
		w.close();
	}
}
